From: Andrew Melnychenko Date: Wed, 7 Dec 2022 11:35:53 +0000 (+0200) Subject: udp: allow header check for dodgy GSO_UDP_L4 packets. X-Git-Tag: archive/raspbian/6.1.106-3+rpi1^2~60 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22%27/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22%27?a=commitdiff_plain;h=4f09502f2eb070b8542bee4708b1a7adee17ad08;p=linux.git udp: allow header check for dodgy GSO_UDP_L4 packets. Origin: https://git.kernel.org/linus/1fd54773c26787b9aea80e2f62c7d0780ea444d0 Allow UDP_L4 for robust packets. Signed-off-by: Jason Wang Signed-off-by: Andrew Melnychenko Signed-off-by: David S. Miller Gbp-Pq: Topic bugfix/all Gbp-Pq: Name udp-allow-header-check-for-dodgy-GSO_UDP_L4-packets.patch --- diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c index 794ea24292f..3322b67c01c 100644 --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c @@ -387,7 +387,8 @@ static struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, if (!pskb_may_pull(skb, sizeof(struct udphdr))) goto out; - if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4) + if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4 && + !skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST)) return __udp_gso_segment(skb, features, false); mss = skb_shinfo(skb)->gso_size; diff --git a/net/ipv6/udp_offload.c b/net/ipv6/udp_offload.c index b98c4c8d8e2..7f0d6ba31ed 100644 --- a/net/ipv6/udp_offload.c +++ b/net/ipv6/udp_offload.c @@ -42,7 +42,8 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, if (!pskb_may_pull(skb, sizeof(struct udphdr))) goto out; - if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4) + if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4 && + !skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST)) return __udp_gso_segment(skb, features, true); mss = skb_shinfo(skb)->gso_size;